package de.mizi.ui.statusbox;

import java.awt.Graphics;

/**
 * This class represents a StatusBoxContent object that consists
 * of a label and two values separated by a delimiter.
 * @author mizi
 *
 */
public class TwoValuesContent extends SingleValueContent {
	protected int value2;
	protected String delimiter;
	
	/**
	 * The default delimiter to separate both value of this StatusBoxContent
	 * object.
	 */
	public static final String DEFAULT_DELIMITER = " / ";
	
	/**
	 * Constructs a concrete StatusBoxContent object with the given position
	 * relative to the position of the StatusBox object this object belongs to.
	 * This StatusBoxContent object has a label and two values separated by a
	 * delimiter. This constructor uses the default delimiter to separate both
	 * values.
	 * @param relativeX the relative x position
	 * @param relativeY the relative y position
	 * @param label the label
	 * @param value1 the first value
	 * @param value2 the second value
	 */
	public TwoValuesContent(int relativeX, int relativeY, String label, int value1, int value2) {
		this(relativeX, relativeY, label, value1, value2, DEFAULT_DELIMITER);
	}
	
	/**
	 * Constructs a concrete StatusBoxContent object with the given position
	 * relative to the position of the StatusBox object this object belongs to.
	 * This StatusBoxContent object has a label and two values separated by a
	 * delimiter.
	 * @param relativeX the relative x position
	 * @param relativeY the relative y position
	 * @param label the label
	 * @param value1 the first value
	 * @param value2 the second value
	 * @param delimiter the delimiter used to separate both values
	 */
	public TwoValuesContent(int relativeX, int relativeY, String label, int value1, int value2, String delimiter) {
		super(relativeX, relativeY, label, value1);
		this.value2 = value2;
		this.delimiter = delimiter;
	}
	
	/**
	 * Get the second value of this StatusBoxContent object.
	 * @return the second value
	 */
	public int getValue2() {
		return value2;
	}

	/**
	 * Set the second value of this StatusBoxContent object.
	 * @param value2 the new second value
	 */
	public void setValue2(int value2) {
		this.value2 = value2;
	}

	/**
	 * Get the delimiter of this StatusBoxContent object.
	 * @return the delimiter
	 */
	public String getDelimiter() {
		return delimiter;
	}

	/**
	 * Set the delimiter of this StatusBoxContent object.
	 * @param delimiter the new delimiter
	 */
	public void setDelimiter(String delimiter) {
		this.delimiter = delimiter;
	}

	@Override
	public void render(Graphics g, int yOffset) {
		g.drawString(label + value + delimiter + value2, relativeX, relativeY - yOffset);
	}
}
